# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models
from django.utils.encoding import python_2_unicode_compatible
# Create your models here.

class User(models.Model):
    username = models.CharField(max_length=20)
    password = models.CharField(max_length=20)
    img = models.ImageField(upload_to='documents/%Y/%m/%d',blank=True,null=True)

class Classify(models.Model):
    classify = models.CharField(max_length=20)

class Question(models.Model):
    title = models.CharField(max_length=50)
    content = models.CharField(max_length=500)

    keyword = models.CharField(max_length=20,blank=True)
    degree = models.IntegerField(default=0,blank=True,null=True)
    datetime = models.DateTimeField(auto_now_add=True)
    u_id = models.ForeignKey(User)
    c_id = models.ForeignKey(Classify)

class Reply(models.Model):
    rep_content = models.CharField(max_length=500)
    datetime = models.DateTimeField(auto_now_add=True)
    u_id = models.ForeignKey(User)
    q_id= models.ForeignKey(Question,on_delete=models.CASCADE)

